package com.lyh.notes.service;

import com.lyh.notes.model.base.ApiResponse;
import com.lyh.notes.model.base.EmptyVO;
import com.lyh.notes.model.dto.user.LoginRequest;
import com.lyh.notes.model.dto.user.RegisterRequest;
import com.lyh.notes.model.dto.user.UpdateUserRequest;
import com.lyh.notes.model.dto.user.UserQueryParam;
import com.lyh.notes.model.entity.User;
import com.lyh.notes.model.vo.user.*;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import java.util.List;
import java.util.Map;

@Transactional
public interface UserService {
    //注册
    ApiResponse<RegisterVO> register(@Valid RegisterRequest registerRequest);

    ApiResponse<LoginUserVO> login(@Valid LoginRequest loginRequest);

    ApiResponse<LoginVO> whoAmI();

    ApiResponse<UserVO> getUserInfo(@Pattern(regexp = "\\d+", message = "ID 格式错误") Long userId);

    ApiResponse<EmptyVO> updateUserInfo(UpdateUserRequest updateUserRequest);

    ApiResponse<AvartarVO> uploadAvatar(MultipartFile file);

    ApiResponse<List<User>> getUserList(@Valid UserQueryParam queryParam);


    Map<Long, User> getUserMapByIds(List<Long> usersId);

    ApiResponse<EmptyVO> deleteUser(@Pattern(regexp = "\\d+", message = "ID 格式错误") Long userId);
}
